#include

#include



using namespace std;



class CPoint

{

protected:

	double m_x, m_y;

public:

	CPoint(double x, double y);

	virtual double Compute_Unit() = 0;

	virtual void Print_Point() {};

};



CPoint::CPoint(double x, double y)

{

	m_x = x;

	m_y = y;

}



class CLengthPoint :public CPoint

{

	double m_z;

public:

	CLengthPoint(double x, double y, double z) : CPoint(x, y) 
	{
		m_z = z;
	}

	double Compute_Unit()

	{

		return sqrt((m_x*m_x) + (m_y*m_y) + (m_z*m_z));

	}

	void Print_Point()

	{

		cout.setf(ios::fixed);

		cout.precision(1);

		cout << "객체 lengthPt의 좌표 : (x : " << m_x << " y : " << m_y << " z : " << m_z << ")\n";



	}

};



class CVolumePoint :public CPoint

{

protected:

	double m_z;

public:

	CVolumePoint(double x, double y, double z) : CPoint(x, y)
	{
		m_z = z;
	}

	double Compute_Unit()

	{

		return m_x*m_y*m_z;

	}

	void Print_Point()

	{

		cout.setf(ios::fixed);

		cout.precision(1);

		cout << "객체 volumePt의 좌표 : (x : " << m_x << " y : " << m_y << " z : " << m_z << ")\n";



	}

};



class CAreaPoint :public CVolumePoint

{

public:

	CAreaPoint(double x, double y, double z)

		:CVolumePoint(x, y, z) {};

	double Compute_Unit()

	{

		return 2 * (m_x*m_y + m_y * m_z + m_z * m_x);

	}

	void Print_Point()

	{

		cout.setf(ios::fixed);

		cout.precision(1);

		cout << "객체 areaPt의 좌표 : (x : " << m_x << " y : " << m_y << " z : " << m_z << ")\n";

	}

};



int main()

{

	CPoint *p;

	CLengthPoint CL(5.7, 12.5, 3.4);

	CVolumePoint CV(11.6, 4.1, 5.4);

	CAreaPoint CA(3.7, 8.9, 4.5);



	p = &CL;

	p->Print_Point();

	cout << "객체 lengthPt의 원점으로부터의 거리 : " << p->Compute_Unit() << endl;

	p = &CV;

	p->Print_Point();

	cout << "객체 volumePt의 육면체 부피 : " << p->Compute_Unit() << endl;

	p = &CA;

	p->Print_Point();

	cout << "객체 areaPt의 육면체 겉넓이 : " << p->Compute_Unit() << endl;



	return 0;

}